package com.jahepi.android;

import android.content.Context;

import com.StarMicronics.StarIOSDK.MiniPrinterFunctions;
import com.StarMicronics.StarIOSDK.MiniPrinterFunctions.BarcodeWidth;
import com.StarMicronics.StarIOSDK.MiniPrinterFunctions.BarcodeType;
import com.StarMicronics.StarIOSDK.PrinterFunctions.Alignment;

public class Impresora {
	
	private String portName;
	private String portSettings;
	private static byte BARCODE_HEIGHT = 90;
	
	public Impresora() {
		portName = "BT:";
		portSettings = "mini";
	}
	
	public void imprimirTexto(String texto, Context context) {
		MiniPrinterFunctions.PrintText(context, portName, portSettings, false, false, false, false, (byte)0, (byte)0, (byte)0, Alignment.Left, texto.getBytes());
	}
	
	public void imprimirCodigoBarras(String dato, Context context) {
		MiniPrinterFunctions.PrintBarcode(context, portName, portSettings, BARCODE_HEIGHT, BarcodeWidth._250, BarcodeType.code128, dato.getBytes());
	}
	
	public boolean estaBien() {
		return MiniPrinterFunctions.isOK(portName, portSettings);
	}
	
	public String getPortName() {
		return portName;
	}

	public String getPortSettings() {
		return portSettings;
	}
}
